# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
 -------------------------------------------------
    File Name:     response_handler.py
    Description:   响应处理与断言模块
 -------------------------------------------------
 """


class ResponseHandler:
    @staticmethod
    def assert_status_code(response, expected_status):
        assert response.status_code == expected_status, f"Expected {expected_status}, got {response.status_code}"

    @staticmethod
    def assert_json_key(self, response, key, expected_value):
        json_response = response.json()
        assert json_response.get(
            key) == expected_value, f"Expected {key} to be {expected_value}, got {json_response.get(key)}"
